﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TOAlignet;
using BOAlignet;

namespace WebAlignet.AlignetFiles.PaseProduccion
{
    public partial class SolPaseProduccion : System.Web.UI.Page
    {
        BOSolPaseProduccion boSolPaseProduccion = new BOSolPaseProduccion();
        BODocumentoVerificacion boDocVerificacion = new BODocumentoVerificacion();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["TipoUsuario"] != null && Session["TipoUsuario"].ToString().Equals("ADMFUNCIONAL"))
                {
                    Button1.Enabled = false;
                }
            }
        }


        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow gvrFila = GridView1.SelectedRow;
            
            Session["codSolicitud"] = gvrFila.Cells[0].Text;
            Session["accion"] = "Modificar";
            Response.Redirect("http://localhost:3182/AlignetFiles/RegistrarDetSolPaseProduccion.aspx");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
                Session["accion"] = "Registrar";
                Response.Redirect("http://localhost:3182/AlignetFiles/RegistrarDetSolPaseProduccion.aspx");
        }

       

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow gvrFila = GridView1.Rows[Convert.ToInt32(e.CommandArgument)];

            int codigo=Convert.ToInt32(gvrFila.Cells[0].Text);
            boSolPaseProduccion.eliminarSolicitud(codigo);

            GridView1.DataBind();
            GridView1.SelectedIndex = -1;
        }
    }
}